package com.cisdi.my.shop.dao.impl;

import com.cisdi.my.shop.dao.UserDao;
import com.cisdi.my.shop.entity.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
 * @author pengyangyan
 * @version 1.0.0
 * @date 2019年09月16日 11:39:00
 */
public class UserDaoImpl implements UserDao {

    private static final Logger logger = LoggerFactory.getLogger(UserDaoImpl.class);

    public User getUserByEmailAndPassword(String email, String password) {

        logger.debug("调用 getUserByEmailAndPassword(),email:{},password:{}",email,password);

        User user = null;
        if ("peng@shuaige.com".equals(email)){
            if ("123456".equals(password)){
                user = new User();
                user.setEmail(email);
                user.setUsername("admin");

                logger.info("成功获取 \"{}\"的用户信息",user.getEmail());
            }
        }else {
            logger.warn("获取\"{}\"的用户信息失败",email);
        }
        return user;
    }
}
